package com.fdd.op.sdk.request.api.contract;

import com.fdd.op.sdk.ApiRuleException;
import com.fdd.op.sdk.BaseFddRequest;
import com.fdd.op.sdk.constants.Constants;
import com.fdd.op.sdk.internal.mapping.RequestField;
import com.fdd.op.sdk.internal.util.StringUtils;
import com.fdd.op.sdk.response.api.contract.AbolishResponse;
import com.fdd.op.sdk.response.api.contract.CheckSignatureResponse;

import java.util.Map;

public class CheckSignatureRequest extends BaseFddRequest<CheckSignatureResponse> {
    @Override
    public String getApiMethodName() {
        return "/base/api/contract/record";
    }

    @Override
    public Map<String, Object> getTextParams() {
        return null;
    }

    @Override
    public Class<CheckSignatureResponse> getResponseClass() {
        return CheckSignatureResponse.class;
    }

    @Override
    public void check() throws ApiRuleException {
        if(StringUtils.isBlank(getDocId()) && StringUtils.isBlank(getTpDocId())){
            throw new ApiRuleException("33030", "文档在在电子签系统的docId与在客户业务系统的tpDocId不允许同时为空！");
        }
        if(StringUtils.isBlank(getNotifyNo())){
            throw new ApiRuleException("33027", "回调流水号notifyNo不允许为空！");
        }
    }

    @Override
    public String getHttpMethod() {
        return Constants.METHOD_POST;
    }

    @RequestField
    private String docId;

    @RequestField
    private String tpDocId;

    @RequestField
    private String notifyNo;

    public String getDocId() {
        return docId;
    }

    public void setDocId(String docId) {
        this.docId = docId;
    }

    public String getTpDocId() {
        return tpDocId;
    }

    public void setTpDocId(String tpDocId) {
        this.tpDocId = tpDocId;
    }

    public String getNotifyNo() {
        return notifyNo;
    }

    public void setNotifyNo(String notifyNo) {
        this.notifyNo = notifyNo;
    }
}
